#include <iostream>
#include <sstream>
#include <fstream>
#include "arexpres.h"
using namespace std;
double Integration(AriphmeticExpression * fun, double const A, double const B, double const EPS)
{
	double i;
	double sum = 0;
	for( i = A ; i < B ; i += EPS)
	{
		sum += (fun -> F(i) + fun -> F(i+EPS)) / 2.0 * EPS;
	}
	return sum;
}
bool Solve(AriphmeticExpression * fun, double const A, double const B, double const EPS, double & ans)
{
	double left = A;
	double right = B+EPS;
	double mid;
	while(left + EPS < right)
	{
		mid = (left + right) / 2.0;
		if(fun->F(mid) - EPS < 0)
		{
			left = mid;
		}
		else
		{
			right = mid;
		}
	}
	ans = left;
	if(fun->F(ans) - EPS < 0 && fun->F(ans) + EPS > 0)
	{
		return true;
	}
	else
	{
		return false;
	}
}
int main()
{
	ifstream in("input.txt");
	ofstream out("output.txt");

	AriphmeticExpression* myArEx = 0;
	string expres;
	string type;
	double a,b,eps;
	int n;
	
	in >> n;
	for(int i = 0; i < n; ++i)
	{
		in >> expres;
		if(myArEx == 0)
		{
			myArEx = new AriphmeticExpression(expres);
		}
		else
		{
			myArEx -> SetExpression(expres);
		}
		in >> type;
		in >> a >> b >> eps;
		if(type == "sol")
		{
			double x = 0;
			if(Solve(myArEx,a,b,eps,x))
			{
				out << x << endl;
			}
			else
			{
				out << "No solution!!!" << endl;
			}
		}
		if(type == "int")
		{
			out << Integration(myArEx, a, b, eps) << endl;
		}
	}
}